﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;
namespace QuanLyPhongGiam
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void sinhViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmDSSV frm = new frmDSSV();
            ////frm.MdiParent = this;
            frm.Show();
        }


        private void thoátToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void toolStripMenuItem14_Click(object sender, EventArgs e)
        {
            frmBaoHanCacGiaiDoan frm = new frmBaoHanCacGiaiDoan();
            ////frm.MdiParent = this;
            frm.Show();
        }
        public void DisableMenu()
        {
            sinhViênToolStripMenuItem.Enabled = false;
            khoaToolStripMenuItem.Enabled = false;
            lớpToolStripMenuItem.Enabled = false;
            mônHọcToolStripMenuItem.Enabled = false;
            tìmKiếmSinhViênToolStripMenuItem.Enabled = false;
            báoCáoSinhViênToolStripMenuItem.Enabled = false;
            toolStripMenuItem14.Enabled = true;
        }

        private void đăngXuấtToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DisableMenu();
        }

        #region waste
        private void khoaToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void lớpToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void mônHọcToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void quảnLýNgườiDùngToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void quảnLýNgườiDùngToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
        }

        private void tìmKiếmSinhViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void đăngNhậpToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void báoCáoSinhViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void trợGiupToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void saoLưuDữLiệuToolStripMenuItem_Click(object sender, EventArgs e)
        {

            //try
            //{
            //    SqlConnection con = new SqlConnection();
            //    con.ConnectionString = KetNoi.str;
            //    con.Open();
            //    SqlCommand cmd = new SqlCommand();
            //    cmd.Connection = con;
            //    cmd.CommandText = "BACKUP DATABASE [QuanLySinhVien] TO DISK='E:\\backup.bak'";
            //    cmd.ExecuteNonQuery();
            //    con.Close();
            //    MessageBox.Show("Backup Database Quản Lý Sinh Viên Thành Công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //}
            //catch (SqlException ex)
            //{
            //    MessageBox.Show(ex.ToString(), "BACKUP DATABASE");
            //    return;
            //}


        }

        private void phụcHồiDữLiệuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //try
            //{
            //    SqlConnection con = new SqlConnection();
            //    con.ConnectionString = KetNoi.str;
            //    con.Open();
            //    string strpath = "E:\\backup.bak";
            //    SqlCommand cmd = new SqlCommand();
            //    cmd.Connection = con;
            //    cmd.CommandText = "USE master RESTORE DATABASE [QuanLySinhVien] FROM DISK='" + strpath + "'";
            //    cmd.ExecuteNonQuery();
            //    con.Close();
            //    MessageBox.Show("Restore Database Quản Lý Sinh Viên Thành Công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //}
            //catch (SqlException ex)
            //{
            //    MessageBox.Show(ex.ToString(), "ERROR RESTORE DATABASE");
            //    return;
            //}
        }

        private void frmMain_Load(object sender, EventArgs e)
        {

        }

        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {

        }
        #endregion

        private void trợGiupToolStripMenuItem_Click_1(object sender, EventArgs e)
        {

        }

        private void tôngHơpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmThongKe frm = new frmThongKe();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void toolStripMenuItem12_Click(object sender, EventArgs e)
        {
            frmPhucHoi frm = new frmPhucHoi();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void toolStripMenuItem11_Click(object sender, EventArgs e)
        {
            frmSaoLuu frm = new frmSaoLuu();
            //frm.MdiParent = this;
            frm.Show();
        }
    }
}
